package dao;

import Util.JDBCUtils;
import entity.User;

import java.util.List;

public class UserDaoImpl implements UserDao{
    @Override
    public User selectUserByUsername(String username){
        List<User> users = JDBCUtils.query(User.class,"select * from t_user where username = ?",username);
        if (users.size()>0){
            return users.get(0);
        }
        return null;
    }

    @Override
    public List<User> selectAllUsers() {
        List<User> users = JDBCUtils.query(User.class,"select * from t_user");
        if (users.size()>0){
            return users;
        }
        return null;
    }
}
